package com.gm.wholesale.module.settlement.ui.tab;

import android.view.View;
import android.widget.BaseAdapter;

import com.gm.commonlib.base.baseAdapter.CommonAdapter;
import com.gm.commonlib.base.baseAdapter.ViewHolder;
import com.gm.commonlib.util.numberUtils.NumberUtils;
import com.gm.wholesale.R;
import com.gm.wholesale.module.settlement.bean.CustomerSettlementBean;
import com.gm.wholesale.module.settlement.ui.detail.SettlementDetailFragment;

public class FinishListFragment extends BaseTabFragment {


    @Override
    protected BaseAdapter createTempBaseAdapter() {
        return new CommonAdapter<>(getActivity(), mDatas, R.layout.list_finish_accunt_item) {
            @Override
            public void convert(ViewHolder viewHolder, final CustomerSettlementBean data) {
                viewHolder.setText(R.id.titleTv, data.getName());
                viewHolder.setText(R.id.createTimeTv, "创建时间：" + data.getCreateTime());
                viewHolder.setText(R.id.numberTv, "对账编号：" + data.getNo());
                viewHolder.setText(R.id.priceTv, "合计金额：" + NumberUtils.getMoneyWithUnitStrig(data.getTotalAmount()));
                viewHolder.getConvertView().setOnClickListener(v -> showFinishDetailUi(data));
            }
        };
    }
    public void showFinishDetailUi(CustomerSettlementBean data) {
        SettlementDetailFragment.showUI(TabType.FINISH_DZ, data,getActivity());
    }


    @Override
    public int getStatus() {
        return TabType.FINISH_DZ;
    }
}
